package com.tma.demo;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity implements OnClickListener {
    private Button mSimpleListButton;
    private Button mSingleSelectionButton;
    private Button mMultiSelectionButton;
    private Button mSpinnerButton;
    private Button mCustomListViewButton;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mSimpleListButton = (Button) findViewById(R.id.btn_simple_list);
        mSingleSelectionButton = (Button) findViewById(R.id.btn_single_selection_list);
        mMultiSelectionButton = (Button) findViewById(R.id.btn_multi_selection_list);
        mSpinnerButton = (Button) findViewById(R.id.btn_spinner);
        mCustomListViewButton = (Button) findViewById(R.id.btn_custom_listview);

        mSimpleListButton.setOnClickListener(this);
        mSingleSelectionButton.setOnClickListener(this);
        mMultiSelectionButton.setOnClickListener(this);
        mSpinnerButton.setOnClickListener(this);
        mCustomListViewButton.setOnClickListener(this);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

    public void onClick(View v) {
        Intent i = null;
        switch (v.getId()) {
        case R.id.btn_simple_list:
            i = new Intent(this, SimpleListActivity.class);
            startActivity(i);
            break;
        case R.id.btn_single_selection_list:
            i = new Intent(this, SingleSelectionListActivity.class);
            startActivity(i);
            break;
        case R.id.btn_multi_selection_list:
            i = new Intent(this, MultiSelectionListActivity.class);
            startActivity(i);
            break;
        case R.id.btn_spinner:
            i = new Intent(this, SpinnerActivity.class);
            startActivity(i);
            break;
        case R.id.btn_custom_listview:
            i = new Intent(this, CustomListViewActivity.class);
            startActivity(i);
            break;
        default:
            break;
        }
    }
}
